package fr.minuskube.inv.opener;

import fr.minuskube.inv.ClickableItem;
import fr.minuskube.inv.SmartInventory;
import fr.minuskube.inv.content.InventoryContents;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;

public interface InventoryOpener {
  Inventory open(SmartInventory paramSmartInventory, Player paramPlayer);
  
  boolean supports(InventoryType paramInventoryType);
  
  default void fill(Inventory handle, InventoryContents contents) {
    ClickableItem[][] items = contents.all();
    for (int row = 0; row < items.length; row++) {
      for (int column = 0; column < (items[row]).length; column++) {
        if (items[row][column] != null)
          handle.setItem(9 * row + column, items[row][column].getItem()); 
      } 
    } 
  }
}
